package cn.tedu.csmall.server.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

@Configuration
public class BeanConfig {

    //驼峰命名：getDate 帕斯卡命名：类名
    @Bean
    @Scope("prototype")
    public Date date(){
        System.out.println("BeanConfig.date()");
        return new Date();
    }

    @Lazy
    @Bean
    public Calendar calendar(){
        System.out.println("BeanConfig.calendar()");
        return Calendar.getInstance();
    }

    @Bean
    public LocalDateTime localDateTime(){
        System.out.println("BeanConfig.localDateTime()");
        return LocalDateTime.now();
    }

//    @Bean
//    public CategoryController categoryController(){
//        System.out.println("BeanConfig.categoryController()");
//        return new CategoryController();
//    }


}
